<?php
	include "./../funcs/dbfunctions.inc";
	$db = new mysqli("127.0.0.1","fc","keks");

$opts = array(
  'http'=>array(
    'method'=>"GET",
    'header'=>"Accept-language: en\r\n" .
              "Cookie: foo=bar\r\n" .
			  "X-Requested-With: XMLHttpRequest"
  )
);

$context = stream_context_create($opts);

/* Sends an http request to www.example.com
   with additional headers shown above */
$handle = fopen("http://worldoftanks.eu/community/clans/500011653/members/?_=1370963506568&offset=0&limit=100&order_by=-role_hierarchy&search=&echo=1&id=clan_members_index", 'r', false, $context);
echo"!!!!!!!";
$buffer = '';
if ($handle) {
	while (!feof($handle)) {
		$buffer .= fgetss($handle, 5000);
	}	
}
fclose($handle);
echo $buffer;
echo"######################";
$playerarray = explode('"account_id": ',$buffer);
foreach($playerarray as $playerstring)
{
	if(!($playerstring===""))
	{
		//echo "[[[[[[[".$playerstring."]]]]]]]";
		$commapos = strpos($playerstring, ',');
		$wotaccountid = substr($playerstring,0,$commapos);
		if(!($wotaccountid===""))
		{
		
			echo "<br>id=".$wotaccountid ."";
			getOrCreateUserByWoTAccountid($db,$wotaccountid);
		}
	}
}
echo "done";
?>